<%@ page language="Java" import="java.util.*,descriptor.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%
	CompaniesListDescriptor compList = (CompaniesListDescriptor)request.getAttribute("Companies");
	String companyID = (String)request.getAttribute("companyID");
	String error1 = (String)request.getAttribute("error1");
	
	String notif = "";
	if(error1 != null)
	{
		notif = "<p style=\"color:red; font-size: 10px;\">" + error1 + "</p>";
	}

%>

<html>
	<jsp:include page="CareerHeader.jsp" >
		<jsp:param name="pageTitle" value="Work Placement Management System - Career Officer" />
	</jsp:include>
	<body  OnLoad="showmenu(document.getElementById('smenu4'));">
		<jsp:include page="CareerPageHeader.jsp"></jsp:include> 
		<div id="container">
			<jsp:include page="CareerMenu.jsp" ></jsp:include>
			<div id="content">
				<h3 class="posttitle">Career Officer - Add a Supervisor</h3>
				<div class="entry">
					<form method="post">
						<input type="hidden" name="action" value="addedSupervisor">
						<%= notif %>
						<fieldset>
							<legend>Select a Company</legend>
							<%
								int sizeList = compList.sizeCompaniesList(); 
								if(sizeList > 0)
								{
							%>
							<p>Select a company in the list to display its details</p>
							<select name="compID">  
							<option value="-1">Select a company: </option>  
							<%
									for(int i=0; i<sizeList; i++)
									{
										String selected = "";
										String compName = compList.getCompanyDescriptors().get(i).getName();
										int compID = compList.getCompanyDescriptors().get(i).getId();
										if(companyID != null && Integer.parseInt(companyID) == compID)
										{
											selected = "selected";
										}
							%>
							<option value="<%= compID %>" <%= selected %>><%= compName %></option>
							<%			
									}
								}
							%>
							</select>
						</fieldset>
						<fieldset>
							<legend>Supervisor's Details</legend>
							<fieldset>
								<legend>Supervisor</legend>
								<p>Surname: <input type="text" name="CompSupSName"></p>
								<p>First Name: <input type="text" name="CompSupFName"></p>
								<p>Email Address : <input type="text" name="CompSupEmail"></p>
							</fieldset>
						<fieldset>
							<p><button type="submit">Add & Generate Password</button> <button type="reset">Clear</button></p>
						</fieldset>
					</form>	
					
				</div>
	    	</div>
			<jsp:include page="CareerPageFooter.jsp"></jsp:include>
		</div>	
	</body>
</html>